// @Author EthanScriptOn
// @Desc
package extend_param_collector

import (
	"github.com/streadway/amqp"
)

type RabbitmqProducerParams struct {
	Params []*RabbitmqProducerParam
}

type RabbitmqProducerParam struct {
	Exchange   string
	Routingkey string
	Mandatory  bool
	Immediate  bool
	Msg        *amqp.Publishing
}

func (r *RabbitmqProducerParams) IsValid() bool {
	if len(r.Params) <= 0 {
		return false
	}
	for _, param := range r.Params {
		if !param.IsValid() {
			return false
		}
	}
	return true
}

func (r *RabbitmqProducerParam) IsValid() bool {
	return r.Exchange != "" && r.Msg != nil
}
